<%@page import="com.skeleton.utils.BaseConstants"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>登录</title>
	<script src="<%=request.getContextPath() %>/resource/js/jquery-1.8.2.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/ske-common.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/ske-constants.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/ske-encrypt.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		function login() {
			var name = $('#loginname').val();
			var pass = $('#password').val();
			if(!isEmpty(name) && !isEmpty(pass)) {
				$.ajax({
					url: "<%=request.getContextPath() %>/user/ajaxLogin",
					data: {
						loginname: name,
						password: encrypt(name, pass)
					},
					dataType: "JSON",
					type: "POST",
					success: function(res) {
						if(res.result == JS_AJAX_SUCCESS) {
							location.href = rootPath+"/index";
						} else {
							alert(res.msg);
						}
					}
				});
			}
		}
	</script>
</head>
<body>
	用户登录<hr />
	用户名：<input type="text" id="loginname" value="aaa"/><br />
	密码：<input type="password" id="password" value="aaa"/><br />
	<input type="button" value="登录" onclick="login()"/><br />
	<a href="<%=request.getContextPath() %>/regist">注册</a>
</body>
</html>